package lormi.meipin.entity;

import java.util.Date;

import com.fasterxml.jackson.annotation.JsonFormat;

import lormi.meipin.dto.WorkedAddDto;
import lormi.meipin.dto.WorkedEditDto;
import lormi.meipin.exception.LMException;

public class Worked {
	
    private Integer id;

    private Integer memid;

    private String company;

    private String department;

    private String title;

    private String remark;

    private Date begintime;

    private Date endtime;

    private Byte ishide;

    private Date createtime;

    private Date updatetime;
    
    public Worked(WorkedAddDto workedAddDto) throws LMException {
		super();
		this.memid = workedAddDto.getUserid();
		this.company = workedAddDto.getCompany();
		this.department = workedAddDto.getDepartment();
		this.remark = workedAddDto.getRemark();
		this.title = workedAddDto.getTitle();
		this.begintime = workedAddDto.getBeginForDate();
		this.endtime = workedAddDto.getEndForDate();
		this.ishide = workedAddDto.getIshide();
		this.createtime = new Date();
		this.updatetime = this.createtime;
	}

    public Worked(WorkedEditDto workedEditDto) throws LMException {
		super();
		this.id = workedEditDto.getId();
		this.memid = workedEditDto.getUserid();
		this.company = workedEditDto.getCompany();
		this.department = workedEditDto.getDepartment();
		this.remark = workedEditDto.getRemark();
		this.title = workedEditDto.getTitle();
		this.begintime = workedEditDto.getBeginForDate();
		this.endtime = workedEditDto.getEndForDate();
		this.ishide = workedEditDto.getIshide();
		this.updatetime = new Date();
	}

	public Worked() {
		super();
	}

	public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public Integer getMemid() {
        return memid;
    }

    public void setMemid(Integer memid) {
        this.memid = memid;
    }

    public String getCompany() {
        return company;
    }

    public void setCompany(String company) {
        this.company = company == null ? null : company.trim();
    }

    public String getDepartment() {
        return department;
    }

    public void setDepartment(String department) {
        this.department = department == null ? null : department.trim();
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title == null ? null : title.trim();
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark == null ? null : remark.trim();
    }
    
    @JsonFormat(pattern = "yyyy年M月d日")
    public Date getBegintime() {
        return begintime;
    }

    public void setBegintime(Date begintime) {
        this.begintime = begintime;
    }

    @JsonFormat(pattern = "yyyy年M月d日")
    public Date getEndtime() {
        return endtime;
    }

    public void setEndtime(Date endtime) {
        this.endtime = endtime;
    }

    public Byte getIshide() {
        return ishide;
    }

    public void setIshide(Byte ishide) {
        this.ishide = ishide;
    }

    public Date getCreatetime() {
        return createtime;
    }

    public void setCreatetime(Date createtime) {
        this.createtime = createtime;
    }

    public Date getUpdatetime() {
        return updatetime;
    }

    public void setUpdatetime(Date updatetime) {
        this.updatetime = updatetime;
    }
}